<?php
/**
 * Static content controller.
 *
 * This file will render views from views/pages/
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Controller
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
App::uses('AppController', 'Controller');

/**
 * Static content controller
 *
 * Override this controller by placing a copy in controllers directory of an application
 *
 * @package       app.Controller
 * @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html
 */
class SportsController extends AppController {

/**
 * This controller does not use a model
 *
 * @var array
 */
	public $uses = array('Tournaments', 'TournamentDates', 'TurnamentMatchs');
	public $components = array('Paginator');
/**
 * Displays a view
 *
 * @param mixed What page to display
 * @return void
 * @throws NotFoundException When the view file could not be found
 *	or MissingViewException in debug mode.
 */
	public function index(){
		$tournaments = $this->paginate('Tournaments');
		$this->set('page_title',"Torneos");
		$this->set('tournaments',$tournaments);	
	}
	
	public function turnament_dates($torunamet_id){
		$this->Paginator->settings = array(
			'conditions' => array('TournamentDates.cattournament_id' => $torunamet_id),
			'order' => array('TournamentDates.dateId DESC')
		);
		$tournaments_dates = $this->paginate('TournamentDates');
		$this->set('page_title',"Fechas");
		$this->set('tournaments_dates',$tournaments_dates);	
	}
	
	public function turnament_matchs($match_id){
		$this->Paginator->settings = array(
			'conditions' => array('TurnamentMatchs.cattournamentdate_id' => $match_id),
			'order' => array('TurnamentMatchs.date DESC')
		);
		$tournaments_matchs = $this->paginate('TurnamentMatchs');
		$this->set('page_title',"Partidos");
		$this->set('tournaments_matchs',$tournaments_matchs);	
	}

	/*
	public function stocks(){
		
		$stocks = $this->paginate('Stocks');// $this->Newsletters->find('all');
		var_dump($stocks);
		$this->set('page_title',"LISTADO DE ACCIONES");
		$this->set('stocks',$stocks);
	}*/
}
